<?php

/**
 * GroundOrder form base class.
 *
 * @method GroundOrder getObject() Returns the current form's model object
 *
 * @package    DUYTAN
 * @subpackage form
 * @author     Your name here
 * @version    SVN: $Id: sfDoctrineFormGeneratedTemplate.php 29553 2010-05-20 14:33:00Z Kris.Wallsmith $
 */
abstract class BaseGroundOrderForm extends BaseFormDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'order_code'    => new sfWidgetFormInputHidden(),
      'customer_id'   => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Customer'), 'add_empty' => true)),
      'ground_id'     => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Ground'), 'add_empty' => true)),
      'reserved_date' => new sfWidgetFormDate(),
      'schedule_id'   => new sfWidgetFormInputText(),
      'status'        => new sfWidgetFormInputText(),
      'note'          => new sfWidgetFormInputText(),
      'created_at'    => new sfWidgetFormDateTime(),
      'updated_at'    => new sfWidgetFormDateTime(),
    ));

    $this->setValidators(array(
      'order_code'    => new sfValidatorChoice(array('choices' => array($this->getObject()->get('order_code')), 'empty_value' => $this->getObject()->get('order_code'), 'required' => false)),
      'customer_id'   => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('Customer'), 'required' => false)),
      'ground_id'     => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('Ground'), 'required' => false)),
      'reserved_date' => new sfValidatorDate(array('required' => false)),
      'schedule_id'   => new sfValidatorInteger(array('required' => false)),
      'status'        => new sfValidatorInteger(array('required' => false)),
      'note'          => new sfValidatorPass(array('required' => false)),
      'created_at'    => new sfValidatorDateTime(),
      'updated_at'    => new sfValidatorDateTime(),
    ));

    $this->widgetSchema->setNameFormat('ground_order[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'GroundOrder';
  }

}
